/**
 * 可达对象
 */

function objGroup (obj1, obj2) {
  obj1.next = obj2
  obj2.prev = obj1

  return {
    o1: obj1,
    o2: obj2,
  }
}

let obj = objGroup({ name: 'obj1' }, { name: 'obj2' })

console.log(obj)

/**
 * 分析代码
 * obj1对象有两条可达途径，obj->o1->obj1，obj->o2->obj2->prev
 * 想要使obj1变成垃圾被回收就要断掉这两条途径
 */

obj.o1 = null
obj.o2.prev = null

